import request from "@/utils/request"

/**
 * 菜单信息 前端接口
 *
 * @author haojun
 * @since 2022-06-12
 */
export default class MenuApi {
  static page(data) {
    let { pageIndex, pageSize, ...vo } = data
    return request.post(`/menu/page/${pageIndex}/${pageSize}`, vo)
  }

  static list(data) {
    return request.post("/menu/list", data)
  }

  static tree() {
    return request.get("/menu/tree")
  }

  static listAndTree() {
    return request.get("/menu/list-tree")
  }

  static getRoute() {
    return request.get("/menu/route")
  }

  static getById(id) {
    return request.get(`/menu/${id}`)
  }

  static save(data) {
    return request.post("/menu", data)
  }

  static update(data) {
    return request.put("/menu", data)
  }

  static delete(id) {
    return request.delete(`/menu/${id}`)
  }

  static deleteByIds(ids) {
    return request.delete("/menu", ids)
  }

};
